package zhtt.action06_result;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

@Results({
        @Result(name = "failure", location = "/505.jsp")
})
public class HelloWorld extends ActionSupport {
    @Action(value = "url01-1",
            results = {@Result(name = "success", location = "http://struts.apache.org",
                    type = "redirect")}
    )
    public String execute() {
        return SUCCESS;
    }

    @Action("url01-2")
    public String doSomething() {
        return SUCCESS;
    }

    @Action(value="url01-3",
            results={@Result(name="success", type="httpheader", params={"status",
                    "500", "errorMessage", "Internal Error"})}
    )
    public String doSomething2() {
        return "failure";
    }
}